package baidu;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author zc
 * @version 1.0
 * @date 2021/9/7 16:28
 * https://www.nowcoder.com/questionTerminal/11b9d12df6b54c73aaccc7289d66f835
 */
public class Main2 {
    static int count = 0;
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int k = Integer.parseInt(str[1]);
        cal(n,k);
        System.out.println(count);
    }

    private static void cal(int n, int k){
        if( n<=k || (n-k)%2 !=0){
            count++;
            return;
        }
        cal((n+k)/2 ,k);
        cal((n-k)/2, k);
        return;
    }
}
